﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>    


		<head>
		<script type="text/javascript" src="<c:url value='/easyui/datagrid-detailview.js'/>"></script>
		<script type="text/javascript">
			$(function(){
				  init();
			  
			});

			function init(){
				
				
				$('#t-dg').datagrid({
				loadMsg:'',
				view:detailview,
				detailFormatter:function(index,row){
				  var content = '';
          
          
          
          if (row.mc)  {
   content += '<span style="color:blue;font-weight:700">单位名称：</span></br>';
   content += '<div style="padding:5px">'+ row.mc.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.sxname)  {
   content += '<span style="color:blue;font-weight:700">单位简称：</span></br>';
   content += '<div style="padding:5px">'+ row.sxname.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.df1)  {
   content += '<span style="color:blue;font-weight:700">电话：</span></br>';
   content += '<div style="padding:5px">'+ row.df1.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.fax)  {
   content += '<span style="color:blue;font-weight:700">传真：</span></br>';
   content += '<div style="padding:5px">'+ row.fax.replace(/\r\n/gi,'<br/>')+'</div>';
}
   content += '<span style="color:blue;font-weight:700">激活：</span></br>';
   content += '<div style="padding:5px">'+ activatedcaption(row.activated)+'</div>';
if (row.expiredate)  {
   content += '<span style="color:blue;font-weight:700">过期日期：</span></br>';
   content += '<div style="padding:5px">'+ row.expiredate.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.jfqk)  {
   content += '<span style="color:blue;font-weight:700">缴费情况：</span></br>';
   content += '<div style="padding:5px">'+ row.jfqk.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.xm)  {
   content += '<span style="color:blue;font-weight:700">姓名：</span></br>';
   content += '<div style="padding:5px">'+ row.xm.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.zw)  {
   content += '<span style="color:blue;font-weight:700">职务：</span></br>';
   content += '<div style="padding:5px">'+ row.zw.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.st)  {
   content += '<span style="color:blue;font-weight:700">手机：</span></br>';
   content += '<div style="padding:5px">'+ row.st.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.st2)  {
   content += '<span style="color:blue;font-weight:700">缩码：</span></br>';
   content += '<div style="padding:5px">'+ row.st2.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.dz1)  {
   content += '<span style="color:blue;font-weight:700">地址：</span></br>';
   content += '<div style="padding:5px">'+ row.dz1.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.yb1)  {
   content += '<span style="color:blue;font-weight:700">邮编：</span></br>';
   content += '<div style="padding:5px">'+ row.yb1.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.em1)  {
   content += '<span style="color:blue;font-weight:700">电子邮箱：</span></br>';
   content += '<div style="padding:5px">'+ row.em1.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.wz1)  {
   content += '<span style="color:blue;font-weight:700">网址：</span></br>';
   content += '<div style="padding:5px">'+ row.wz1.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.qy)  {
   content += '<span style="color:blue;font-weight:700">区域：</span></br>';
   content += '<div style="padding:5px">'+ row.qy.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.bz)  {
   content += '<span style="color:blue;font-weight:700">备注：</span></br>';
   content += '<div style="padding:5px">'+ row.bz.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.icp)  {
   content += '<span style="color:blue;font-weight:700">相关证件：</span></br>';
   content += '<div style="padding:5px">'+ row.icp.replace(/\r\n/gi,'<br/>')+'</div>';
}
   content += '<span style="color:blue;font-weight:700">用户类型：</span></br>';
   content += '<div style="padding:5px">'+ showusertype(row.usertype)+'</div>';
if (row.company_id)  {
   content += '<span style="color:blue;font-weight:700">公司帐号：</span></br>';
   content += '<div style="padding:5px">'+ row.company_id.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.mainid)  {
   content += '<span style="color:blue;font-weight:700">归属单位：</span></br>';
   content += '<div style="padding:5px">'+ row.mainid.replace(/\r\n/gi,'<br/>')+'</div>';
}
   content += '<span style="color:blue;font-weight:700">显示首页：</span></br>';
   content += '<div style="padding:5px">'+ showcaption(row.showtop)+'</div>';
   content += '<span style="color:blue;font-weight:700">首页条数：</span></br>';
   content += '<div style="padding:5px">'+ row.topcount+'</div>';
   content += '<span style="color:blue;font-weight:700">显示网站：</span></br>';
   content += '<div style="padding:5px">'+ showcaption(row.showweb)+'</div>';
   content += '<span style="color:blue;font-weight:700">网站条数：</span></br>';
   content += '<div style="padding:5px">'+ row.webcount+'</div>';
if (row.indate)  {
   content += '<span style="color:blue;font-weight:700">加入时间：</span></br>';
   content += '<div style="padding:5px">'+ row.indate.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.outdate)  {
   content += '<span style="color:blue;font-weight:700">离开时间：</span></br>';
   content += '<div style="padding:5px">'+ row.outdate.replace(/\r\n/gi,'<br/>')+'</div>';
}

           
					return '<div style="padding:5px">' + content + '</div>';
				}
				
			});
				
			}
			
			
function formatactivated(value,row){
      return activatedcaption(row.activated);
}

function formatusertype(value,row){
  return showusertype(row.usertype);	
}

function formatshowtop(value,row){
	
	      return showcaption(row.showtop);
}

function formatshowweb(value,row){
	      return showcaption(row.showweb);
}

function showusertype(utype){
	if (utype == 0){
		return "中介";
	}else if (utype == 1){
		return "开发商";
	}else if (utype == 2){
		return "个人用户";
	}	
}

function showcaption(show){
	if (show == 0){
		return "不显示";
	}else if (show == 1){
		return "显示";
	}	
	
}

function activatedcaption(activated){
	if (activated == 0){
		return "<font color=red>未激活</font>";
	}else if (activated == 1){
		return "<font color=blue>激活</font>";
	}else if (activated == 9){
		return "停用";	
	}	
}

			
			
			var actionUrl;
			
			
			function editItem(){
				var t = $('#t-dg');
				var row = t.datagrid('getSelected');
				if (row){
					$('#myform').form('load', row);
					$('#dlg').dialog('setTitle', '修改单位信息').dialog('open');
					actionUrl = '<c:url value="/operset/Zjlist/updateZjlist"/>?id=' + row.id;
				}
			}
			
			
			function saveItem(){
				$('#myform').form('submit', {
					url:actionUrl,
					onSubmit:function(){
						return $('#myform').form('validate');
					},
					success:function(data){
						var data = eval('('+data+')');
						if (data.success){
							$('#dlg').dialog('close');
							$('#t-dg').datagrid('reload');
						} else {
							$.messager.show({
								title:'保存失败',
								msg:'<pre>'+data.msg+'</pre>'
							});
						}
					}
				});
			}
			
			
			
		</script>
	</head>
	<body>
		<div class="easyui-layout" fit="true">
			<div region="north" border="false" style="height:40px;padding:5px;">
				<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-edit" onclick="editItem()">修改单位信息</a>
			</div>
			<div region="center" border="true">
	      <table id="t-dg" style="display:none;"
						url="<c:url value='/operset/Zjlist/getZjlistItems'/>"
						singleSelect="true" rownumbers="true" pagination="true"
						border="false" fit="true" >
					<thead>
						<tr>
<th field="mc" width="100" sortable="true">单位名称</th>
<th field="sxname" width="100" sortable="true">单位简称</th>
<th field="company_id" width="100" sortable="false">公司帐号</th>
<th field="activated" width="50" sortable="true" formatter="formatactivated">状态</th>
<th field="expiredate" width="100" sortable="false">过期日期</th>
<th field="df1" width="100" sortable="false">电话</th>
<th field="fax" width="100" sortable="false">传真</th>
<th field="xm" width="100" sortable="false">姓名</th>
<th field="zw" width="100" sortable="false">职务</th>
<th field="st" width="100" sortable="false">手机</th>
<th field="st2" width="100" sortable="false">缩码</th>
<th field="lxr" width="100" sortable="false">联系人</th>
<th field="usertype" width="100" sortable="false" formatter="formatusertype">用户类型</th>
<th field="showtop" width="100" sortable="false" formatter="formatshowtop">显示首页</th>
<th field="showweb" width="100" sortable="false" formatter="formatshowweb">显示网站</th>

						</tr>
					</thead>
				</table>			
			</div>
		</div>
		
		
		
			<div id="dlg" style="width:400px;
<c:if test="${cfgs['menulayout'] == 'default'}">
height:380px; 
</c:if>
<c:if test="${cfgs['menulayout'] == 'topbottom'}">
height:250px; 
</c:if>
"
				class="easyui-dialog" closed="true" modal="true" buttons="#dlg-buttons">
			<div style="padding:10px">
				<div style="float:left">
					<form id="myform" method="post" style="margin:0;padding:0">
						<table>
							<tr>
<td style="width:80px">单位名称</td>
<td><input type="text" class="easyui-validatebox e-input" id="mc" name="mc" style="width:250px;" data-options="required:true,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">单位简称</td>
<td><input type="text" class="easyui-validatebox e-input" id="sxname" name="sxname" style="width:250px;" data-options="required:true,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">电话</td>
<td><input type="text" class="easyui-validatebox e-input" id="df1" name="df1" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">传真</td>
<td><input type="text" class="easyui-validatebox e-input" id="fax" name="fax" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">姓名</td>
<td><input type="text" class="easyui-validatebox e-input" id="xm" name="xm" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">职务</td>
<td><input type="text" class="easyui-validatebox e-input" id="zw" name="zw" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">手机</td>
<td><input type="text" class="easyui-validatebox e-input" id="st" name="st" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">缩码</td>
<td><input type="text" class="easyui-validatebox e-input" id="st2" name="st2" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">地址</td>
<td><input type="text" class="easyui-validatebox e-input" id="dz1" name="dz1" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">邮编</td>
<td><input type="text" class="easyui-validatebox e-input" id="yb1" name="yb1" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">电子邮箱</td>
<td><input type="text" class="easyui-validatebox e-input" id="em1" name="em1" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">网址</td>
<td><input type="text" class="easyui-validatebox e-input" id="wz1" name="wz1" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">区域</td>
<td><input type="text" class="easyui-validatebox e-input" id="qy" name="qy" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
<tr>
<td style="width:80px">备注</td>
<td>
<textarea type="text" class="easyui-validatebox e-input" id="bz" name="bz" style="width:250px;height:50px" ></textarea>
</td>
</tr>	
<tr>
<td style="width:80px">联系人</td>
<td>
<textarea type="text" class="easyui-validatebox e-input" id="lxr" name="lxr" style="width:250px;height:50px" ></textarea>
</td>
</tr>	
<tr>
<td style="width:80px">相关证件</td>
<td><input type="text" class="easyui-validatebox e-input" id="icp" name="icp" style="width:250px;" data-options="required:false,editable:true" ></input></td>
</tr>	
				
						</table>
					</form>
				</div>			
				<div style="clear:both"></div>
			</div>
			<div id="dlg-buttons" style="text-align:center;">
				<a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="saveItem()">保存</a>
				<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
			</div>
		</div>
		
		
		
		
	</body>
